package com.zqxq.lottery.entity.o2o.jczq;

import com.zqxq.common.utils.BigDecimalUtils;
import com.zqxq.common.utils.DispatcherUtils;
import com.zqxq.lottery.entity.po.jczq.JczqGrandPO;
import com.zqxq.lottery.entity.vo.jczq.JczqGrandVO;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;


public class JczqGrandO2O {

    public static JczqGrandVO toVO(JczqGrandPO po) {
        if (po == null) {
            return null;
        }
        JczqGrandVO jczqGrandVO = new JczqGrandVO();
        jczqGrandVO.setUserId(DispatcherUtils.parseString(po.getUser_id()));
        BigDecimal payDecimal = BigDecimalUtils.getValue(po.getPay(),2) ;
        String pay = payDecimal == null ? null : payDecimal.toPlainString();
        jczqGrandVO.setPay(pay);
        BigDecimal prizeDecimal = BigDecimalUtils.getValue(po.getPrize(),2) ;
        String prize = prizeDecimal == null ? null : prizeDecimal.toPlainString();
        jczqGrandVO.setPrize(prize);
        BigDecimal maxPrizeDecimal = BigDecimalUtils.getValue(po.getMax_prize(),2) ;
        String maxPrize = maxPrizeDecimal == null ? null : maxPrizeDecimal.toPlainString();
        jczqGrandVO.setMaxPrize(maxPrize);
        jczqGrandVO.setOrderNum(DispatcherUtils.parseString(po.getOrder_num()));
        jczqGrandVO.setWinNum(DispatcherUtils.parseString(po.getWin_num()));
        jczqGrandVO.setLossNum(DispatcherUtils.parseString(po.getLoss_num()));
        BigDecimal hitDecimal = BigDecimalUtils.getValue(po.getHit(),2) ;
        String hit = hitDecimal == null ? null : hitDecimal.toPlainString();
        jczqGrandVO.setHit(hit);
        return jczqGrandVO;
    }

    public static List<JczqGrandVO> toVOList(List<JczqGrandPO> list){
        List<JczqGrandVO> result = new ArrayList<>();
        if(list != null && list.size() > 0){
            for (JczqGrandPO po : list) {
                result.add(toVO(po));
            }
        }
        return result;
    }


}
